
// 利用函数来模拟实现 new
function Otaku (name, age) {
  this.name = name
  this.age = age
}

Otaku.prototype.sayName = function () {
  console.log('name', this.name)
}

// 模拟new过程
function creatObj () {
  var obj = new Object()
  Otaku.call(obj, ...arguments)

  obj.__proto__ = Otaku.prototype

  return obj
}

var obj = creatObj('lee', 28)
obj.sayName()

console.log('newObjectProto', obj.__proto__)
console.log('newObject', obj)